import request from "./request";
/**
 *分享
 * @param name 页面名字
 * @param red_id 红包id
 */
const share = function(name,red_id){
    request('share/red',{
        red_id
    })
        .then((res)=>{
            if(res.data.status === 'success'){
                let share_data = res.data.data;
                window.wx.ready(()=>{
                    window.wx.updateAppMessageShareData(share_data);
                    window.wx.updateTimelineShareData(share_data);
                    window.wx.onMenuShareTimeline(share_data);
                    window.wx.onMenuShareAppMessage(share_data);
                });
            }
        });
}

export default share;
